﻿<%@page import="com.hhit.collaborative_learning.learning.StoreData"%>
<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

// 	StoreData.getBlog(1);
// 	request.setAttribute("twoDays", StoreData.twoDaysBlog);
// 	StoreData.getBlog(2);
// 	request.setAttribute("newestRec", StoreData.newestRecommendBlog);
// 	StoreData.getNewestExperts();
// 	request.setAttribute("newestExpert", StoreData.newestExperts);
// 	StoreData.getPrimeBlog();
// 	request.setAttribute("primeBlog", StoreData.primeBlog);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--new top-->
<link rel="stylesheet" href="<%=basePath%>css/index.css">
<!--new top-->

<link rel="Stylesheet" type="text/css" href="<%=basePath%>css/home.css" />
<script src="<%=basePath%>js/jquery.js" type="text/javascript"></script>
<script src="<%=basePath%>js/home.js" type="text/javascript"></script>
<script src="<%=basePath%>js/plugins.js" type="text/javascript"></script>
<!-- <script type="text/javascript" src="<%=basePath%>js/cnick.js"></script> -->
<script type='text/javascript'>
(function(){
$(function(){
	var back_top_value =Math.ceil(document.documentElement.clientHeight *0.65);
	var float_ask_img="<div data-mod='popu_64' class='tracking-ad' chg-blk='0' ><a id='com-d-top-a'  style='top:"+back_top_value+"px' title='返回顶部' onclick='' ></a> </div>";
	$("body").append(float_ask_img);
	
	var d_top = $('#com-d-top-a');

        $(document).scroll(function(){
            var scrTop = (document.body.scrollTop || document.documentElement.scrollTop);
            if (scrTop > 500)
            {
                d_top.show();
            } else
            {
                d_top.hide();
            }

        })
        $('#com-d-top-a').click(function ()
        {
            scrollTo(0, 0);
            this.blur();
            return false;
        });
});
})();
</script>
<link href="<%=basePath%>css/ask_float_block.css" type="text/css"
	rel="stylesheet" />

</head>
<body>
	<div role="banner" class="blog-nav">
		<div class="container">
			<div role="navigation" class="navbar-collapse">
				<ul class="navbar-nav">
					<li class=active><a
						href="<%=basePath%>learning/learning.jsp" target="_top" title="">首页</a></li>
					<li><a href="<%=basePath%>learning/expert.jsp">博客专家</a></li>
					<li><a href="" class="rss" link="learning/myblog.jsp?page=bloglist" onclick="checkLogin(this)"
						target="_blank">我的专题</a></li>
					<li><a href="<%=basePath %>learning/search.jsp?type=1" target="_blank">搜索</a></li>
				</ul>
			</div>
		</div>
	</div>

	<div id="wrap">

		<div class="main_con">
			<script type="text/javascript" src="<%=basePath%> %>js/login.js"></script>

<!-- 			<script type="text/javascript"> -->
<!-- 				var ua = navigator.userAgent.toLowerCase(); -->
<!-- 				if (ua.indexOf('phone') > -1 || ua.indexOf('android') > -1 -->
<!-- 						|| ua.indexOf('wap') > -1) { -->
<!-- 					if (document.cookie.indexOf('wap-pc') == -1) { -->
<!-- 						location = 'http://m.blog.csdn.net'; -->
<!-- 						//window.stop ? window.stop() : document.execCommand("Stop"); -->
<!-- 					} -->
<!-- 				} -->
<!-- 				$(function() { -->
<!-- 					var uns = ""; -->
<!-- 					$.each($(".expert dt"), function(index, item) { -->
<!-- 						var un = $(this).find("a").attr("un"); -->
<!-- 						$(this).append( -->
<!-- 								'<a href="javascript:void(0);" class="focus"  onclick="start_guanzhu(' -->
<!-- 										+ "'" + un + "'" + ')" >关注</a>'); -->
<!-- 						uns = uns + un + ","; -->
<!-- 					}); -->
<!-- 					$.get("/Article/GetArticle.html?Uns=" + uns, -->
<!-- 							function(data) { -->
<!-- 								$(".expert").last().after(data); -->
<!-- 							}); -->
<!-- 				}); -->

<!-- 				var _blogger = ""; -->
<!-- 				function start_guanzhu(blogger) { -->
<!-- 					_blogger = blogger; -->
<!-- 					var un = getUN().toLowerCase(); -->

<!-- 					if (un.length > 0) { -->
<!-- 						set_guanzhu_status(un); -->
<!-- 					} else { -->
<!-- 						//if (un != "") { -->
<!-- 						loginto(0); -->
<!-- 						//} -->
<!-- 					} -->
<!-- 				} -->

<!-- 				function set_guanzhu_status(un) { -->
<!-- 					var url = "http://my.csdn.net/index.php/follow/check_is_followed/" -->
<!-- 							+ encodeURIComponent(un) -->
<!-- 							+ "/" -->
<!-- 							+ encodeURIComponent(_blogger) + "?jsonpcallback=?"; -->
<!-- 					$.getJSON(url, {}, function(data) { -->
<!-- 						if (data.succ == 1 && data.info == 1) { -->
<!-- 							alert('已经关注！'); -->
<!-- 						} else { -->
<!-- 							guanzhu(); -->
<!-- 						} -->
<!-- 					}, 'json'); -->
<!-- 				} -->
<!-- 				function guanzhu() { -->
<!-- 					var url = "http://my.csdn.net/index.php/follow/do_follow?jsonpcallback=?"; -->
<!-- 					$.getJSON(url, { -->
<!-- 						"username" : _blogger -->
<!-- 					}, function(data) { -->
<!-- 						if (data.succ == 1) { -->
<!-- 							alert('关注成功！'); -->
<!-- 						} else { -->
<!-- 							alert(data.msg); -->
<!-- 						} -->
<!-- 					}); -->
<!-- 					return false; -->
<!-- 				} -->
<!-- 				function getUN() { -->
<!-- 					var m = document.cookie.match(new RegExp( -->
<!-- 							"(^| )UserName=([^;]*)(;|$)")); -->
<!-- 					if (m) -->
<!-- 						return m[2]; -->
<!-- 					else -->
<!-- 						return ''; -->
<!-- 				} -->
<!-- 				function loginto(n) { -->
<!-- 					if (!n) { -->
<!-- 						csdn.showLogin(function(data) { -->
<!-- 							js_logined(data.data.userName); -->
<!-- 						}); -->
<!-- 					} else { -->
<!-- 						if (!getUN()) { -->
<!-- 							csdn.showLogin(function(data) { -->
<!-- 								js_logined(data.data.userName); -->
<!-- 							}); -->
<!-- 						} else { -->
<!-- 							location = 'http://my.csdn.net/my/letter/send/' -->
<!-- 									+ _blogger; -->
<!-- 						} -->
<!-- 					} -->
<!-- 				} -->
<!-- 				function js_logined(un) { -->
<!-- 					location = '?reload'; -->
<!-- 				} -->
<!-- 			</script> -->
			<div class="main_left">
				<div class="side_nav">
					<ul>
						<li <c:if test="${requestScope.type eq 'all'}">class=select</c:if>><a
							href="<%=basePath %>learning/main_learning.jsp" name="all">全部分类</a></li>
						<li
							<c:if test="${requestScope.type eq 'mobile'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=mobile" target="_self"
							name="mobile">移动开发</a></li>
						<li <c:if test="${requestScope.type eq 'web'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=web" target="_self"
							name="web">Web前端</a></li>
						<li
							<c:if test="${requestScope.type eq 'enterprise'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=enterprise" target="_self"
							name="enterprise">架构设计</a></li>
						<li
							<c:if test="${requestScope.type eq 'code'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=code" target="_self"
							name="code">编程语言</a></li>
						<li <c:if test="${requestScope.type eq 'www'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=www" target="_self"
							name="www">互联网</a></li>
						<li
							<c:if test="${requestScope.type eq 'database'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=database" target="_self"
							name="database">数据库</a></li>
						<li
							<c:if test="${requestScope.type eq 'system'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=system" target="_self"
							name="system">系统运维</a></li>
						<li
							<c:if test="${requestScope.type eq 'cloud'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=cloud" target="_self"
							name="cloud">云计算</a></li>
						<li
							<c:if test="${requestScope.type eq 'software'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=software" target="_self"
							name="software">研发管理</a></li>
						<li
							<c:if test="${requestScope.type eq 'other'}">class=select</c:if>><a
							href="<%=basePath%>GetBlogServlet?type=other" target="_self"
							name="other">综合</a></li>
					</ul>
				</div>

				<style type="text/css">
#home_cmd_col {
	padding: 0px 4px;
}

#home_cmd_col dt {
	width: 66px;
}

#home_cmd_col dt img {
	width: 64px;
	height: 64px;
}
</style>

				<div class="bor_box">
					<h1>推荐博客专家</h1>
					<dl class="experts">
						<dt>移动开发</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.mobileExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>Web前端</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.webExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>架构设计</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.enterpriseExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>编程语言</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.codeExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>互联网</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.wwwExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>数据库</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.databaseExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>系统运维</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.systemExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>云计算</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.cloudExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
						<dt>研发管理</dt>
						<dd>
							<ul>
								<c:forEach items="${sessionScope.experts.softwareExperts }"
									var="experts">
									<li><a href='personal.jsp?userId=${experts.userId }'
										target="_blank">${experts.userNickName }</a></li>
								</c:forEach>
							</ul>
						</dd>
					</dl>
				</div>
				<!--AdForward Begin:-->
				<!-- 				<script type="text/javascript" -->
				<!-- 					src="http://csdnim.allyes.com/main/s?user=csdn|blog|skyscraper&db=csdnim&border=0&local=yes&js=ie" -->
				<!-- 					charset="gbk"></script> -->
				<!--AdForward End-->

			</div>
			<div class="main_center">

				<div id="sub_tab">
					<c:choose>
						<c:when test="${requestScope.type eq 'all'}">
							<a href="<%=basePath %>learning/main_learning.jsp?orderby=time"
								target="_self"
								<c:if test="${requestScope.orderby eq 'time'}">class="curr"</c:if>>最新</a>
							<a href="<%=basePath %>learning/main_learning.jsp" target="_self"
								<c:if test="${requestScope.orderby eq null || requestScope.orderby eq ''}">class="curr"</c:if>
								style="margin-right:2px;">最热</a>
						</c:when>
						<c:otherwise>
							<a href="<%=basePath %>GetBlogServlet?orderby=time&type=${requestScope.type}"
								target="_self"
								<c:if test="${requestScope.orderby eq 'time'}">class="curr"</c:if>>最新</a>
							<a href="<%=basePath %>GetBlogServlet?type=${requestScope.type}" target="_self"
								<c:if test="${requestScope.orderby eq null || requestScope.orderby eq ''}">class="curr"</c:if>
								style="margin-right:2px;">最热</a>
						</c:otherwise>
					</c:choose>
				</div>
				<c:forEach items="${requestScope.blogPage.list }" var="blog">
					<div class="blog_list">
						<h1>
							<!-- 							<a href="<%=basePath%>GetBlogServlet?type=${blog.category}" -->
							<!-- 								class="category" target="_self">[${blog.category_CN}]</a>  -->
							<a name="${blog.blogId }"
								href="<%=basePath%>learning/article.jsp?blogId=${blog.blogId }&userId=${blog.userId}&blogName=${blog.blogName}" target="_blank">${blog.blogName
								}</a>
						</h1>

						<dl>
							<dt>
								<a href="personal.jsp?userId=${blog.userId }" target="_blank">
									<img src="<%=basePath %>userIcons/${blog.userIcon}"
									alt="${blog.userId }" />
								</a>
							</dt>
							<dd>${blog.blogDesc }</dd>
						</dl>
						<p>
							<c:forEach items="${blog.tag }" var="tag">
								<a class="tag" href="/tag/details.html?tag=${tag }"
									target="_blank">${tag }</a>
							</c:forEach>
						</p>
						<div class="about_info">
							<span class="fr digg" id="digg_${blog.blogId }" blog="11566"
								digg="${blog.goodNum }" bury="${blog.badNum }"></span> <span
								class="fl"> <a href="personal.jsp?userId=${blog.userId }"
								target="_blank" class="user_name">${blog.userName }</a> <span
								class="time">${blog.time }</span> <a
								href="<%=basePath%>learning/article.jsp?blogId=${blog.blogId }&userId=${blog.userId}&blogName=${blog.blogName}" target="_blank"
								class="view">阅读(${blog.readNum })</a> <a
								href="<%=basePath%>learning/article.jsp?blogId=${blog.blogId }&userId=${blog.userId}&blogName=${blog.blogName}#comments"
								target="_blank" class="comment">评论(${blog.commentNum })</a>
							</span>
						</div>
					</div>
				</c:forEach>
				<div class="page_nav">
						<span> ${requestScope.blogPage.count }条数据
							共${requestScope.blogPage.totalPage }页</span>
						<c:if test="${requestScope.blogPage.currentPage>1}">
							<c:choose>
								<c:when test="${requestScope.type eq 'all'}">
									<a
										href="<%=basePath%>learning/main_learning.jsp?orderby=${requestScope.orderby}">首页</a>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=1&type=${requestScope.type}&orderby=${requestScope.orderby}">首页</a>
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when
									test="${requestScope.type eq 'all' && requestScope.blogPage.currentPage==2}">
									<a
										href="<%=basePath%>learning/main_learning.jsp?orderby=${requestScope.orderby}">上一页</a>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.currentPage-1}&type=${requestScope.type}&orderby=${requestScope.orderby}">上一页</a>
								</c:otherwise>
							</c:choose>
						</c:if>
						<c:if test="${requestScope.blogPage.pageDiffer>0}">
							<c:choose>
								<c:when
									test="${requestScope.type eq 'all' && requestScope.blogPage.pageDiffer*5-4==1}">
									<a
										href="<%=basePath%>learning/main_learning.jsp?type=${requestScope.type}&orderby=${requestScope.orderby}">...</a>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5-4}&type=${requestScope.type}&orderby=${requestScope.orderby}">...</a>
								</c:otherwise>
							</c:choose>
						</c:if>

						<c:if
							test="${requestScope.blogPage.pageDiffer*5+1<=requestScope.blogPage.totalPage}">
							<c:choose>
								<c:when
									test="${requestScope.blogPage.currentPage==requestScope.blogPage.pageDiffer*5+1 }">
									<strong>${requestScope.blogPage.pageDiffer*5+1}</strong>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5+1}&type=${requestScope.type}&orderby=${requestScope.orderby}">${requestScope.blogPage.pageDiffer*5+1}</a>
								</c:otherwise>
							</c:choose>
						</c:if>

						<c:if
							test="${requestScope.blogPage.pageDiffer*5+2<=requestScope.blogPage.totalPage}">
							<c:choose>
								<c:when
									test="${requestScope.blogPage.currentPage==requestScope.blogPage.pageDiffer*5+2 }">
									<strong>${requestScope.blogPage.pageDiffer*5+2}</strong>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5+2}&type=${requestScope.type}&orderby=${requestScope.orderby}">${requestScope.blogPage.pageDiffer*5+2}</a>
								</c:otherwise>
							</c:choose>
						</c:if>

						<c:if
							test="${requestScope.blogPage.pageDiffer*5+3<=requestScope.blogPage.totalPage}">
							<c:choose>
								<c:when
									test="${requestScope.blogPage.currentPage==requestScope.blogPage.pageDiffer*5+3 }">
									<strong>${requestScope.blogPage.pageDiffer*5+3}</strong>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5+3}&type=${requestScope.type}&orderby=${requestScope.orderby}">${requestScope.blogPage.pageDiffer*5+3}</a>
								</c:otherwise>
							</c:choose>
						</c:if>

						<c:if
							test="${requestScope.blogPage.pageDiffer*5+4<=requestScope.blogPage.totalPage}">
							<c:choose>
								<c:when
									test="${requestScope.blogPage.currentPage==requestScope.blogPage.pageDiffer*5+4 }">
									<strong>${requestScope.blogPage.pageDiffer*5+4}</strong>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5+4}&type=${requestScope.type}&orderby=${requestScope.orderby}">${requestScope.blogPage.pageDiffer*5+4}</a>
								</c:otherwise>
							</c:choose>
						</c:if>

						<c:if
							test="${requestScope.blogPage.pageDiffer*5+5<=requestScope.blogPage.totalPage}">
							<c:choose>
								<c:when
									test="${requestScope.blogPage.currentPage==requestScope.blogPage.pageDiffer*5+5 }">
									<strong>${requestScope.blogPage.pageDiffer*5+5}</strong>
								</c:when>
								<c:otherwise>
									<a
										href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5+5}&type=${requestScope.type}&orderby=${requestScope.orderby}">${requestScope.blogPage.pageDiffer*5+5}</a>
								</c:otherwise>
							</c:choose>
						</c:if>
						<c:if
							test="${requestScope.blogPage.totalPage>5 && requestScope.blogPage.pageDiffer<requestScope.blogPage.totalPage/5-1}">
							<a
								href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.pageDiffer*5+6}&type=${requestScope.type}&orderby=${requestScope.orderby}">...</a>
						</c:if>
						<c:if
							test="${requestScope.blogPage.currentPage<requestScope.blogPage.totalPage}">
							<a
								href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.currentPage+1}&type=${requestScope.type}&orderby=${requestScope.orderby}">下一页</a>
							<a
								href="<%=basePath%>GetBlogServlet?currentPage=${requestScope.blogPage.totalPage}&type=${requestScope.type}&orderby=${requestScope.orderby}">尾页</a>
						</c:if>
				</div>

			</div>
			<div class="main_right">
				<div class="write-boke">
					<a href="" onclick="checkLogin(this)" link="learning/myblog.jsp?page=postedit"
						target="_blank"></a>
				</div>
				<div class="boke-expert">
					<a href="" onclick="checkLogin(this)" link="learning/apply_expert.jsp" target="_blank"></a>
				</div>

				<div class="box_1">
					<h2>两天热门文章</h2>
					<ul class="list_2">
						<c:forEach items="${requestScope.twoDays }" var="blog">
							<li><a href="<%=basePath%>learning/article.jsp?blogId=${blog.blogId }&userId=${blog.userId}&blogName=${blog.blogName}"
								target="_blank" title="${blog.blogName }">${blog.blogName }</a></li>
						</c:forEach>
					</ul>
				</div>

				<style>
.main_right .box_1 {
	margin-top: 10px;
}
</style>
<script type="text/javascript">
	function checkLogin(e){
		var userId=$.cookie("userId");
		if(userId==null||userId.trim()==""){
			e.href="<%=basePath%>login.jsp?link="+encodeURIComponent($(e).attr("link"));
		}else{
			e.href="<%=basePath%>"+$(e).attr("link");
		}
	}
</script>
				<div class="box_1">
					<h2>最新推荐文章</h2>
					<ul class="list_2">
						<c:forEach items="${requestScope.newestRec }" var="blog">
							<li><a href="<%=basePath%>learning/article.jsp?blogId=${blog.blogId}&userId=${blog.userId}&blogName=${blog.blogName}"
								target="_blank" title="${blog.blogName }">${blog.blogName }</a></li>
						</c:forEach>
					</ul>
				</div>
			</div>

		</div>

	</div>

</body>
</html>
